package com.e_manager.soft.emanager.rabbitMQ;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;


/**
 * Created by Administrator on 2017/3/25 0025.
 */
public class MessageProducer {
    private Logger logger = LoggerFactory.getLogger(MessageProducer.class);

    //@Resource
    //private AmqpTemplate amqpTemplate;

    //private RabbitTemplate rabbitTemplate;

    private RabbitTemplate rabbitTemplate;

    public RabbitTemplate getRabbitTemplate() {
        return rabbitTemplate;
    }

    public void setRabbitTemplate(RabbitTemplate rabbitTemplate) {
        this.rabbitTemplate = rabbitTemplate;
    }

    public void sendMessage(Object message){
        logger.info("to send message:{}",message);
        //amqpTemplate.convertAndSend("queueTestKey",message);
        //amqpTemplate.send((Message) message);
        //rabbitTemplate.convertAndSend(message);
        rabbitTemplate.convertAndSend("bendao_down",message);
        //rabbitTemplate.convertAndSend("queueTestKey",message);
    }
}
